#pragma once

#include "Vectors.h"
#include "Serializable.h"
#include "Types.h"

struct TeamItemHistory
{
	TeamItemHistory(const int i_topGoalPlayerID = Utilities::INVALID_ID,
					const int i_topGoal = 0,
		            const int i_topMomPlayerID = Utilities::INVALID_ID,
					const int i_topMom = 0,
		            const int i_topRatingPlayerID = Utilities::INVALID_ID,
					const int i_topRating = 0,
					const int i_year = 0,
					const int i_leagueID = Utilities::INVALID_ID,
					const int i_leaguePosition = 0)
	{
		m_topGoalPlayerID = i_topGoalPlayerID;
		m_topGoal = i_topGoal;
		m_topMomPlayerID = i_topMomPlayerID;
		m_topMom = i_topMom;
		m_topRatingPlayerID = i_topRatingPlayerID;
		m_topRating = i_topRating;
		m_year = i_year;
		m_leagueID = i_leagueID;
		m_leaguePosition = i_leaguePosition;
	}

	void Serialize(ZStream& o_stream) const;
	void Deserialize(ZStream& i_stream);

	int m_topGoalPlayerID;
	int m_topGoal;

	int m_topMomPlayerID;
	int m_topMom;

	int m_topRatingPlayerID;
	int m_topRating;

	int m_year;
	int m_leagueID;
	int m_leaguePosition;
};

class TeamHistory : public Serializable
{
public:
	TeamHistory();
	void Init(size_t i_param, const int i_startingYear);

	void AddTeamItemHistory(const PeopleVec& i_player, size_t i_year, int i_leagueID, int i_leaguePosition, unsigned int i_minNumMatchesForTopEval);
	const STL::vector<TeamItemHistory>& GetItems() const;

	void SetTotalPodium();
	void SetPodium(size_t i_pos);
	void SetYearsInLeagueLayer(size_t i_layerIndex);
	void SetBankruptCount();

	const size_t GetNumSeason(size_t i_index) const;

	size_t GetTotalPodium() const;
	IntVec GetPodium() const;
	IntVec GetYearsInLeagueLayer() const;
	size_t GetBankruptCount() const;

	virtual	ZStream& Serialize(ZStream& o_stream) const;
	virtual ZStream& Deserialize(ZStream& i_stream);

private:

	STL::vector<TeamItemHistory> m_items;
	size_t m_totalPodium;
	IntVec m_podium;
	IntVec m_yearsInLeagueLayer;
	size_t m_bankruptCount;
	size_t m_currentYear;
	int m_startingYear;
};

#include "TeamHistory.inl"

